<h1 id="数值类型">数值类型</h1>
<p>数值类型包含整型<code>Integer</code>，浮点型<code>Float</code>, 它们皆占64个比特</p>
<p>实例</p>
<pre><code class="hljs language-javascript"><span class="hljs-title function_">println</span>(<span class="hljs-number">3.14</span> * <span class="hljs-number">3</span>) <span class="hljs-comment">// 9.42</span>
<span class="hljs-title function_">println</span>(<span class="hljs-number">10</span> / <span class="hljs-number">3.0</span>) <span class="hljs-comment">// 3.33333</span>
<span class="hljs-title function_">println</span>(<span class="hljs-number">10</span> / <span class="hljs-number">3</span>) <span class="hljs-comment">// 3</span>
<span class="hljs-title function_">println</span>(<span class="hljs-number">24</span> / <span class="hljs-number">6</span>) <span class="hljs-comment">// 4</span>

<span class="hljs-comment">// 负数</span>
<span class="hljs-title function_">println</span>(<span class="hljs-number">10</span> + -<span class="hljs-number">5.5</span>) <span class="hljs-comment">// 4.5</span>
<span class="hljs-title function_">println</span>(-<span class="hljs-number">3.14</span> + <span class="hljs-number">2</span>) <span class="hljs-comment">// -1.1400000000000001</span>
<span class="hljs-title function_">echo</span>(-<span class="hljs-number">1</span> + <span class="hljs-number">9.8</span>, <span class="hljs-number">7.3</span> + - <span class="hljs-number">1.1</span>)
</code></pre>
<h2 id="string-转-number">String 转 Number</h2>
<pre><code class="hljs language-javascript"><span class="hljs-title function_">echo</span>(<span class="hljs-string">&quot;98&quot;</span>.<span class="hljs-title function_">int</span>(), <span class="hljs-string">&quot;98&quot;</span>.<span class="hljs-title function_">int</span>().<span class="hljs-title function_">type</span>())
<span class="hljs-title function_">echo</span>(<span class="hljs-string">&quot;0.5&quot;</span>.<span class="hljs-title function_">float</span>(), <span class="hljs-string">&quot;0.5&quot;</span>.<span class="hljs-title function_">float</span>().<span class="hljs-title function_">type</span>())
<span class="hljs-title function_">echo</span>(<span class="hljs-string">&quot;110&quot;</span>.<span class="hljs-title function_">number</span>(), <span class="hljs-string">&quot;110&quot;</span>.<span class="hljs-title function_">number</span>().<span class="hljs-title function_">type</span>())
<span class="hljs-title function_">echo</span>(<span class="hljs-string">&quot;6.28&quot;</span>.<span class="hljs-title function_">number</span>(), <span class="hljs-string">&quot;6.28&quot;</span>.<span class="hljs-title function_">number</span>().<span class="hljs-title function_">type</span>())
<span class="hljs-title function_">echo</span>(<span class="hljs-string">&quot;a&quot;</span>.<span class="hljs-title function_">int</span>(), <span class="hljs-string">&quot;b&quot;</span>.<span class="hljs-title function_">float</span>(), <span class="hljs-string">&quot;c&quot;</span>.<span class="hljs-title function_">number</span>())
</code></pre>
<pre><code>98 Int
0.5 Float
110 Int
6.28 Float
-1 -1 -1
</code></pre>
<h2 id="number-转-string">Number 转 String</h2>
<p>加一个空字符串<code>&quot;&quot;</code>即可</p>
<pre><code class="hljs language-javascript">str = -<span class="hljs-number">6.23</span> + <span class="hljs-string">&quot;&quot;</span>
<span class="hljs-title function_">echo</span>(str, str.<span class="hljs-title function_">type</span>())
</code></pre>
<pre><code>-6.23 String
</code></pre>
<h2 id="number-转-bytearray">Number 转 ByteArray</h2>
<pre><code class="hljs language-javascript">i = <span class="hljs-number">10086</span>
f = <span class="hljs-number">3.14</span>
i.<span class="hljs-title function_">bytes</span>().<span class="hljs-title function_">show</span>()
f.<span class="hljs-title function_">bytes</span>().<span class="hljs-title function_">show</span>()
</code></pre>
<pre><code>00000000 00000000 00000000 00000000 00000000 00000000 00100111 01100110 
00011111 10000101 11101011 01010001 10111000 00011110 00001001 01000000 
</code></pre>
